package com.wang.example.bio;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * 传统BIO 多线程
 */
public class MultiThreadServer {
	public static void main(String[] args) throws IOException {
		ServerSocket serverSocket = new ServerSocket(8000);
		System.out.println("服务端启动...");
		while (true) {
			// 获取socket套接字
			// accept()阻塞点
			Socket socket = serverSocket.accept();
			System.out.println("有新客户端连接上来了...");
			//开启一个子线程专门负责与该客户端的通信
			new Thread(new BioSeverHandler(socket)).start();
		}
	}
}
